import java.util.Random;
import java.util.Scanner;

public class Text2 {
    public static void main(String[] args) {
        Random rand = new Random();
        int Guess = rand.nextInt(101);
        System.out.println("Guess = " + Guess);
        Scanner sc = new Scanner(System.in);
        int count = 5;
        while(count != 0) {
            System.out.println("请输入您猜的数字：");
            int guess = sc.nextInt();
            if(guess == Guess) {
                System.out.println("恭喜你，猜对了！");
                break;
            }
            else if(guess > Guess) {
                System.out.println("猜大了");
            }
            else {
                System.out.println("猜小了");
            }
            count--;
            System.out.println("你剩余的机会还有：" + count + "次");
        }
        if (count == 0) {
            System.out.println("很遗憾你的机会用完了，正确答案是：" + Guess);
        }
        sc.close();
    }
}
